package com.sinven.serviceImpl;

import com.sinven.daoImpl.ChannelDaoImpl;
import com.sinven.daoImpl.CommentDaoImpl;
import com.sinven.entity.Comment;
import com.sinven.service.CommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service("CommentService")
@Transactional
public class CommentServiceImpl implements CommentService {

    @Autowired
    private CommentDaoImpl commentDao;
    @Override
    public List<Comment> listComment() {
        String hql="from Comment";
        return commentDao.listComment(hql);
    }

    @Override
    public int addComment(Comment comment) {
        return  commentDao.addComment(comment);
    }

    @Override
    public List<Comment> selectCommentBygoodsId(Integer goodsId) {
        return commentDao.selectCommentBygoodsId(goodsId);
    }

    @Override
    public List<Comment> selectCommentByCommentId(Integer commId) {
        return commentDao.selectCommentByCommentId(commId);
    }
}
